package com.star.news.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.star.news.dto.NewsCollectSaveDTO;
import com.star.news.entity.NewsCollect;
import com.star.news.mapper.NewsCollectMapper;
import com.star.news.service.NewsCollectService;
import com.star.news.struct.NewsCollectStruct;
import org.springframework.stereotype.Service;

/**
 * @author lintianyi
 * @version 1.0
 * @date 2024/6/27 15:58
 */
@Service
public class NewsCollectServiceImpl extends ServiceImpl<NewsCollectMapper, NewsCollect> implements NewsCollectService {


    @Override
    public void save(NewsCollectSaveDTO dto) {
        this.save(NewsCollectStruct.INSTANCE.to(dto));
    }

    @Override
    public void cancelNewsCollect(Long id) {
        this.removeById(id);
    }
}
